Another tip, using only ISO functions from string.h:

Code:
char *foo( char *s )
{
  char *p;
  char tmp;
  ssize_t size;

  // get the size of final string.
  size = snprintf( &tmp, 1, "%s *** %s", s, s );

  // allocate space, fill the buffer and return the pointer.
  p = new char[size+1];
  sprintf( p, "%s *** %s", s, s );
  return p;
}